﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace LowLevelGraphics.Filter
{
    /// <summary>
    /// This uses a LonelyPixel Filter and afterwards
    /// a PerPixel Filter to extract contours
    /// </summary>
    public class ImproveMode
    {
        protected List<IteratedFilter> m_aList = new List<IteratedFilter>();
        public ImproveMode()
        {
           m_aList.AddRange(
               new IteratedFilter[]{
                   new Invert(), 
                   new UmgekehrtMultiplizieren(), 
                   new Invert(), 
                   new UmgekehrtMultiplizieren()
               });
        }

        internal List<IteratedFilter> List
        {
            get { return m_aList; }
        }
    }

    public class ImproveModeNegativeMultiply : ImproveMode
    {
        public ImproveModeNegativeMultiply()
        {
            m_aList.AddRange(
                    new IteratedFilter[]{
                   new Invert(), 
                   new Multiplizieren(), 
                   new Invert(), 
                   new Multiplizieren()
               });
        }
    }

    public class Improve : MacroFilter
    {
        private List<IteratedFilter> m_aListImproveMultiply = new List<IteratedFilter>();
        private List<IteratedFilter> m_aListImproveNegativMultiply = new List<IteratedFilter>();

        private ImproveMode m_ImproveMode = new ImproveMode();


        /// <summary>
        /// Initializes a new instance of the <see cref="ContourExtractionTwoSteps"/> class.
        /// </summary>
        public Improve()
        {
            this.m_aFilter.AddRange(m_ImproveMode.List);
        }

        public Improve(ImproveMode _improveMode)
        {
            Mode = _improveMode;
        }
        public ImproveMode Mode
        {
            get { return m_ImproveMode; }
            set 
            {
                m_ImproveMode = value;
                this.m_aFilter.Clear();
                this.m_aFilter.AddRange(m_ImproveMode.List);
            }
        }
    }
}
